package com.example.aop_test.aspect;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2023-03-23
 * Time: 11:01
 */
@Component
@Aspect
public class StuAspect {


    //定义一个切点
    @Pointcut("execution(* com.example.aop_test.controller.StudentController.*(..))")
    public void pointcut(){
    }

    @Before("pointcut()")
    public void doBefore(){
        System.out.println("前置通知：被执行了");
    }

    @After("pointcut()")
    public void doAfter(){
        System.out.println("后置通知:被执行了");
    }

    @AfterReturning("pointcut()")
    public void AfterReturning(){
        System.out.println("返回之后的通知");
    }

    @AfterThrowing("pointcut()")
    public void doAfterThrowing(){
        System.out.println("出现异常之后执行力");
    }

//
//    @Around("pointcut()")
//    public Object doAround(){
//
//        System.out.println("环绕通知");
//
//        return null;
//    }
//
//




}
